Chuyển tới nội dung chính

Claim Giftcode From Webview

Flow 1:

Overview:

  • Enter the webview by clicking on the Dzo icon.
  • Claim Giftcode
  • Get giftcode form 'DzoSDK.GetInstance().claimGiftCodeCallback' and send request add Item to Server Game.
  • Call method ConsumeGiftCode to SDK after add Item successful.

Init:

After Init SDK Successful we need regist callback Claim Giftcode From Dzo Webview:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_login);
// ------ Init DzoSDK ------- //
if(!DzoSDK.GetInstance().IsConnected()){
DzoSDK.GetInstance().Init(this, new DzoInitCallback() {
@Override
public void OnInitSuccess() {
// --- Init Successful --- //
// … Your code … //
// - Register callback Claim GiftCode - //
DzoSDK.GetInstance().claimGiftCodeCallback = new DzoClaimGiftCodeCallback() {
@Override
public void OnClaimGiftCode(String _giftCode, String _severGameID) {
Log.d(DzoSDK.TAG, ">>> Claim GiftCode: " + _giftCode + " - serverGameID: " + _severGameID);
// … Your code … //
// Call method add Item by this gift code //
}
};
// ---------------------------------- //

DzoSDK.GetInstance().Login(); // After Init SDK Successful, you can call Login.
}

……
});
} else {
DzoSDK.GetInstance().Login();
}
// -------------------------- //
// … Your code … //
}

Consume:

After use giftcode and add Item successful, we need to call method Consume to SDK

    DzoSDK.GetInstance().ConsumeGiftCode(_giftCode);

Flow 2:

Overview:

  • Enter the webview by clicking on the Dzo icon.
  • Claim Giftcode